package com.spring.sunflower.main.adapter;

import android.graphics.Color;
import android.widget.TextView;

import androidx.core.content.ContextCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.spring.sunflower.R;
import com.spring.sunflower.bean.LabelBean;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * Created by Kevin on 2021/6/17<br/>
 * <p>
 * Describe:<br/>
 */
public class RecommendLabelAdapter extends BaseQuickAdapter<LabelBean.DatasBean, BaseViewHolder> {
    public RecommendLabelAdapter(int layoutResId, @Nullable List<LabelBean.DatasBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, LabelBean.DatasBean datasBean) {
        baseViewHolder.setText(R.id.tvLabel, datasBean.getName());
        TextView tv = baseViewHolder.getView(R.id.tvLabel);
        if (datasBean.isChecked()) {
            tv.setTextColor(Color.WHITE);
            tv.setBackgroundResource(R.drawable.ic_btn_bg_stroke_yellow_fill);
        } else {
            tv.setTextColor(ContextCompat.getColor(getContext(), R.color.colorPrimary));
            tv.setBackgroundResource(R.drawable.ic_btn_bg_stroke_yellow_normal);
        }
    }
}
